package com.frxuexi.park2303.user.adapter

import android.graphics.Color
import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.base.entity.MyApplyBean
import com.frxuexi.park2303.R
import com.frxuexi.park2303.databinding.ItemMyaskBinding

class MyApplyAdapter:BaseQuickAdapter<MyApplyBean,BaseViewHolder> (R.layout.item_myask){
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemMyaskBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: MyApplyBean) {
        val binding = DataBindingUtil.getBinding<ItemMyaskBinding>(helper.itemView)!!
        binding.bean=item

        binding.historyStatus.apply {
            when(item.status){
                "空闲","已通过","已完成"->setTextColor(Color.GREEN)
                "已占用","待审核","待处理","未巡检"->setTextColor(Color.BLUE)
                "维护中","驳回","处理中","巡检中"->setTextColor(context.resources.getColor(com.frxuexi.base.R.color.orange))
            }
        }
    }
}